﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;

namespace WebAppDemo.AjaxPage
{
    /// <summary>
    /// Summary description for GenerateJS
    /// </summary>
    public class GenerateJS : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            if (System.DateTime.Now<new DateTime(2013,12,16,15,54,59))
            {
                context.Response.ContentType = "application/x-javascript";//"application/javascript";
                StringBuilder sb = new StringBuilder();
                sb.Append("var i = 0;");
                sb.Append("jwplayer().onBeforePlay(function (event) {");
                sb.Append("if (i == 0) {");
                sb.Append("jwplayer().seek(20);");
                sb.Append("i = 1;");
                sb.Append("}");
                sb.Append("});");
                context.Response.Write(sb.ToString());
            }
            context.Response.Write("");
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}